def list_while_func():
    mylist = ["小明", "小刚", "小红"]
    # 定义一个变量用来标记列表的下标
    index = 0
    while index < len(mylist):
        # 通过index变量取出对应下标的元素
        element = mylist[index]
        print(f"列表的元素:{element}")

# 将循环变量（index）每次循环都+1
        index += 1


list_while_func()

def list_for_func():
    mylist = ["小明", "小刚", "小红"]
    index = 0
    for element in mylist:
        print(f"列表的元素有：{element}")


list_for_func()
